package top.continew.admin.jobfair.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;

import org.springframework.stereotype.Service;

import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
import top.continew.admin.jobfair.mapper.CompanyJobfairMapper;
import top.continew.admin.jobfair.model.entity.CompanyJobfairDO;
import top.continew.admin.jobfair.model.query.CompanyJobfairQuery;
import top.continew.admin.jobfair.model.req.CompanyJobfairReq;
import top.continew.admin.jobfair.model.resp.CompanyJobfairDetailResp;
import top.continew.admin.jobfair.model.resp.CompanyJobfairResp;
import top.continew.admin.jobfair.service.CompanyJobfairService;

/**
 * 公司参会业务实现
 *
 * @author xiahaike
 * @since 2024/09/12 12:53
 */
@Service
@RequiredArgsConstructor
public class CompanyJobfairServiceImpl extends BaseServiceImpl<CompanyJobfairMapper, CompanyJobfairDO, CompanyJobfairResp, CompanyJobfairDetailResp, CompanyJobfairQuery, CompanyJobfairReq> implements CompanyJobfairService {

    @Resource
    private CompanyJobfairMapper companyJobfairMapper;

    @Override
    public Boolean selectOne(Long companyId, Long jobfairId) {
        QueryWrapper<CompanyJobfairDO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("company_id", companyId);
        queryWrapper.eq("job_fair_id", jobfairId);
        CompanyJobfairDO companyJobfairDO = companyJobfairMapper.selectOne(queryWrapper);
        return companyJobfairDO == null;
    }
}